/**************************************************************************************
*
*	Copyright (C) 2009 Brent Andrew Chua - See LICENSE.txt for more info.
*		
*	Filename	-	BackBuffer.h
*
*	Description -	Renders all objects to an offscreen then presents it to the front
*					buffer in one blit call.
*
*	Comments	-	If you don't understand some parts of the code, use MSDN!!!
*					Move the cursur to the function/type then hit F1 in VS.
*
*
*	Modification History:
*			Name			   Date					Description
*			CodeSushi	-	11/17/2009	-	Creation of this file
**************************************************************************************/

#ifndef _BACK_BUFFER_H_
#define _BACK_BUFFER_H_

#include <windows.h>
#include "../../Pulse Lib/Include/Pulse.h"

using namespace Pulse;

class BackBuffer
{
public:

	BackBuffer( HWND hWnd, INT width, INT height );
	~BackBuffer();

	HDC GetDC( void );

	UINT GetWidth( void );
	UINT GetHeight( void );

	// Call this function when you want it to present to
	// the Fron buffer.
	void Present( void );

	void Clear( const UINT color = 0 );		// Color is currently not used... it paints the screen black.

private:

	// No operator =
	BackBuffer & operator = ( const BackBuffer &rhs );

	HWND m_hWnd;
	HDC m_hdc;
	HBITMAP m_hSurface;
	HBITMAP m_hOldSurface;
	INT m_appWidth;
	INT m_appHeight;

};

PSX_INLINE HDC BackBuffer::GetDC( void )
{
	return m_hdc;
}

PSX_INLINE UINT BackBuffer::GetWidth( void )
{
	return m_appWidth;
}

PSX_INLINE UINT BackBuffer::GetHeight( void )
{
	return m_appHeight;
}



#endif /* _BACK_BUFFER_H_ */